import { defineComponent } from 'vue';
import {
  getEditorEmits,
  getSpanProps,
  useNamespace,
} from '@ibiz-template/vue3-util';
import { EditorPluginController } from './editor.controller';
import './editor.scss';

export const EditorPlugin = defineComponent({
  name: 'IBizEditorPlugin',
  props: getSpanProps<EditorPluginController>(),
  emits: getEditorEmits(),
  setup(props) {
    const ns = useNamespace('editor-plugin');
    const c = props.controller;

    return {
      c,
      ns,
    };
  },
  render() {
    return (
      <div
        class={[
          this.ns.b(),
          this.disabled ? this.ns.m('disabled') : '',
          this.readonly ? this.ns.m('readonly') : '',
        ]}
      >
        这是一个编辑器插件
      </div>
    );
  },
});
